<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Parent{
            constructor(name){
                this.name = name;

            }
           
        }
        class Child extends Parent{
            constructor(name,age){
                super(name)//直接继承父类属性
                this.age= age
            }
        }
        let child = new Child('dog',10)
        console.log(child)
        console.log(child.age)
    </script>
</body>
</html>